package me.mingshan.leetcode;

/**
 * @author hanjuntao
 * @date 2025/7/29 0029
 */
public class ListNode {
    int val;
    ListNode next;
    ListNode(int x) { val = x; }

    static void print(ListNode head) {
        StringBuilder sb = new StringBuilder("[");
        for (ListNode current = head; current != null; current = current.next) {
            sb.append(current.val + ", ");
        }

        int len = sb.length();
        System.out.println(sb.delete(len - 2, len).append("]").toString());
    }
}
